package com.og.backingbean;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;

/**
 * @author Renaud DIANA
 *
 */
@Entity
@NamedQueries({@NamedQuery(name = "Composition.findAll", query = "SELECT c FROM Composition c ORDER BY c.idComposition ASC")})
public class Composition implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
	private int idComposition;
	@NotNull
	@Past
	@Column(nullable = false)
	@Temporal(TemporalType.DATE)
	private Date date;
	@NotNull
	@ManyToOne
	@JoinColumn(nullable = false)
	private Module module;
	@NotNull
	@ManyToOne
	@JoinColumn(nullable = false)
	private Application application;
	
	/**
	 * 
	 */
	public Composition() {
		// TODO Auto-generated constructor stub
	}

	public int getIdComposition() {
		return idComposition;
	}

	public void setIdComposition(int idComposition) {
		this.idComposition = idComposition;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Module getModule() {
		return module;
	}

	public void setModule(Module module) {
		this.module = module;
	}

	public Application getApplication() {
		return application;
	}

	public void setApplication(Application application) {
		this.application = application;
	}

}
